package com.ruoyi.project.jiaqin.companyvideo.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.jiaqin.companyvideo.mapper.CompanyVideoMapper;
import com.ruoyi.project.jiaqin.companyvideo.domain.CompanyVideo;
import com.ruoyi.project.jiaqin.companyvideo.service.ICompanyVideoService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 宣传视频Service业务层处理
 *
 * @author admin
 * @date 2021-01-27
 */
@Service
public class CompanyVideoServiceImpl implements ICompanyVideoService
{
    @Autowired
    private CompanyVideoMapper companyVideoMapper;

    /**
     * 查询宣传视频
     *
     * @param id 宣传视频ID
     * @return 宣传视频
     */
    @Override
    public CompanyVideo selectCompanyVideoById(String id)
    {
        return companyVideoMapper.selectCompanyVideoById(id);
    }
    public Integer selectCompanyVideoCountByCompanyId(String companyId){
        return companyVideoMapper.selectCompanyVideoCountByCompanyId(companyId);
    }
    /**
     * 查询宣传视频列表
     *
     * @param companyVideo 宣传视频
     * @return 宣传视频
     */
    @Override
    public List<CompanyVideo> selectCompanyVideoList(CompanyVideo companyVideo)
    {
        return companyVideoMapper.selectCompanyVideoList(companyVideo);
    }

    /**
     * 新增宣传视频
     *
     * @param companyVideo 宣传视频
     * @return 结果
     */
    @Override
    public int insertCompanyVideo(CompanyVideo companyVideo)
    {
        companyVideo.setId(UUID.randomUUID().toString().replace("-",""));
        return companyVideoMapper.insertCompanyVideo(companyVideo);
    }

    /**
     * 修改宣传视频
     *
     * @param companyVideo 宣传视频
     * @return 结果
     */
    @Override
    public int updateCompanyVideo(CompanyVideo companyVideo)
    {
        return companyVideoMapper.updateCompanyVideo(companyVideo);
    }

    /**
     * 删除宣传视频对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCompanyVideoByIds(String ids)
    {
        return companyVideoMapper.deleteCompanyVideoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除宣传视频信息
     *
     * @param id 宣传视频ID
     * @return 结果
     */
    @Override
    public int deleteCompanyVideoById(String id)
    {
        return companyVideoMapper.deleteCompanyVideoById(id);
    }
}
